//
//  BHApplyTeamTextFieldCell.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/6/16.
//

import UIKit

class BHApplyTeamTextFieldCell: UITableViewCell {
    var teamNameDidEndEditingBlock:((String) -> Void)?
    

    @IBOutlet weak var cover_view: UIView!
    
    @IBOutlet weak var teamNameTextField: UITextField!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.cover_view.addLayerCorner(4, 0, .white)
        let placeAttribute = "请输入战队名称".toAttribute()
        placeAttribute.addFont(.systemFont(ofSize: 14, weight: .medium))
        placeAttribute.addAllTextColor(.color_999999)
        
        self.teamNameTextField.attributedPlaceholder = placeAttribute
        
        self.teamNameTextField.delegate = self
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}

extension BHApplyTeamTextFieldCell: UITextFieldDelegate {
    func textFieldDidEndEditing(_ textField: UITextField) {
        self.teamNameDidEndEditingBlock?(textField.text ?? "")
    }
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        return true
    }
}
